﻿#pragma once


#include <QDialog>
#include <QPushButton>
#include "QListView"
#include "QStringListModel"
#include "QFileDialog"
#include "QMessageBox"
#include "QApplication"
#include "QVBoxLayout"
#include <QDesktopWidget>
#include <QLibrary>
#include <QApplication>
#include <QLabel>
#include <QComboBox>
#include "QListView"
#include "QStringListModel"
#include "QLineEdit"
#include "QSpinBox"
#include "QRadioButton"
#include <QSettings>

#include "commonfunction.h"

#include "halcon_opencv.h"

using namespace std;

#include "qt_graphics_view_image.h"
#include "qt_graphics_shape_rectangle.h"


class DetectionGRAY :public QDialog
{
public:
    QSettings* m_qsettings;
    QString m_section   = "";

    MyQGraphicsView* m_view ;


    QLabel* m_qlabel_area_low_threshold;
    QSpinBox* m_qspinbox_area_low_threshold;
    int m_area_low_threshold=0;

	QLabel * m_qlabel_area_up_threshold;
	QSpinBox * m_qspinbox_area_up_threshold;
	int m_area_up_threshold = 0;

    QLabel * m_qlabel_low;
    QSpinBox * m_qspinbox_low;
    QSlider* m_qslider_low;
	int m_low;

    QLabel * m_qlabel_high;
    QSpinBox * m_qspinbox_high;
    QSlider* m_qslider_high;
	int m_high;

    
    QPushButton* m_pushbutton_show_orign_image;
    QPushButton* m_pushbutton_detection;
    QPushButton* m_pushbutton_save_parameter;
    QPushButton* m_pushbutton_return;

    QLabel* m_qlabel_message;

    int m_result;

    int row1, column1, row2, column2;
    

    int m_size_error_now;
    

    HDevProcedure* m_proc_detection;
    HDevProcedureCall* m_call_detection;
    HObject region_show;

    Mat m_image ;

   

public:
    explicit DetectionGRAY(QDialog *parent = nullptr, QSettings* qsettings = nullptr,QString section="") ;
    ~DetectionGRAY() ;
    virtual void detectionImage();
    virtual bool detection( HObject image_in, QString& message);
    virtual void draw( Mat image_in,Mat& image_out);
    virtual void loadParameter();
    virtual void saveParameter();
    virtual bool showDialog();
    void testImage();
};
#pragma execution_character_set("utf-8")
